package com.example.service;

import com.example.task.MsgTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.concurrent.ThreadPoolExecutor;

@Service
public class UserServiceImpl implements UserService {

    @Resource
    private ThreadPoolExecutor threadPoolExecutor;

    @Override
    public String hello() {
        String msg = "Hello World";
//        threadPoolExecutor.execute(new MsgTask(msg));
        threadPoolExecutor.submit(new MsgTask(msg));
        return "Hello World";
    }

}
